<%= render  :partial => "apo/navigation" %>

<div id="containerBody">

    <%= error_messages_for "member" %>

    <% if @error != nil %>
    	<h2> <font color = "red"> <%= @error %> </font></h2>
    <% end %>

    <% if session[:user].admin? or @member == session[:user] %>

        <h1>Member Information</h1>

        <div class="container">

            <% form_tag :action => "save" , :id => params[:id]  do %>

                <div class="cellRow">
                    <% if session[:user].admin? %>

                        <div class="cellBlock">Username</div>
                        <div class="cellBlock"><%= text_field "member" , h("username"), :maxlength => 15 %></div>

                    <% else %>

                        <div class="cellBlock">Username</div>
                        <div class="cellBlock"><%= @member.username %></div>

                    <% end %>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">First Name</div>
                    <div class="cellBlock"><%= text_field "member" , h("first_name"), :maxlength => 20 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Last Name</div>
                    <div class="cellBlock"><%= text_field "member" , h("last_name"), :maxlength => 20 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Birthday</div>
                    <div class="cellBlock"><%= date_select("member", h("birthday"), :start_year => 1950, :order => [:month, :day, :year])%></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">&nbsp;</div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Email</div>
                    <div class="cellBlock"><%= text_field "member" , h("email") , :maxlength => 30 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Phone Number</div>
                    <div class="cellBlock"><%= text_field "member" , h("phone_number"), :maxlength => 12 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Screen Name</div>
                    <div class="cellBlock"><%= text_field "member" , h("screen_name"), :maxlength => 30 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">&nbsp;</div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Pledge Class</div>
                    <div class="cellBlock"><%= select "member" , "pledge_class" , PledgeClass.find(:all, :order => "name ASC").map {|pc| [pc.name]} %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Status</div>
                    <div class="cellBlock"><%= select "member", "status", {"" => nil, "Pledge" => "Pledge", "New Active" => "New Active", "Active" => "Active", "Associate" => "Associate", "Probate" => "Probate", "Neophyte" => "Neophyte", "Alum" => "Alum", "Advisor" => "Advisor", "Away From School" => "Away From School" }.sort %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">&nbsp;</div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Permanent Address</div>
                    <div class="cellBlock"><%= text_field "member" , h("permanent_address_one"), :maxlength => 50 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock" style="text-align: right;">(line 2)</div>
                    <div class="cellBlock"><%= text_field "member" , h("permanent_address_two"), :maxlength => 50 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">City</div>
                    <div class="cellBlock"><%= text_field "member" , h("permanent_city"), :maxlength => 30 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">State</div>
                    <div class="cellBlock"><%= text_field "member" , h("permanent_state"), :maxlength => 2 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Zip Code</div>
                    <div class="cellBlock"><%= text_field "member" , h("permanent_zip"), :maxlength => 10 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">&nbsp;</div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">University Address</div>
                    <div class="cellBlock"><%= text_field "member" , h("school_address_one"), :maxlength => 50 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock" style="text-align: right;">(line 2)</div>
                    <div class="cellBlock"><%= text_field "member" , h("school_address_two"), :maxlength => 50 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">City</div>
                    <div class="cellBlock"><%= text_field "member" , h("school_city"), :maxlength => 9 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">State</div>
                    <div class="cellBlock"><%= text_field "member" , h("school_state"), :value => "IL", :maxlength => 2 %></div>
                </div>

                <div class="cellRow">
                    <div class="cellBlock">Zip Code</div>
                    <div class="cellBlock"><%= text_field "member" , h("school_zip"), :maxlength => 10 %></div>
                </div>

                <% if session[:user].admin? %>

                    <div class="cellRow">
                        <div class="cellBlock">Administrator</div>
                        <div class="cellBlock"><%= check_box "member" , h("admin") %></div>
                    </div>

                <% end %>

                <div class="cellRow">
                    <div class="cellBlock">&nbsp;</div>
                </div>

                <%= submit_tag "Save"%>

                <% if session[:user].admin? and @member.id != nil %>
                    <%= submit_tag "Remove"%>
                <% end %>

            <%end%>

        </div>

        <div id="eventBottomDiv" style="float: none; text-align: left;">
            <% if session[:user].admin or @member == session[:user] %>
                <%= link_to "Change Password" , :action => "change_password" , :id => @member %>
            <% end%>
        </div>

    <% else %>

        <H1>What are you doing here? =)</H1>

    <% end %>

</div>
